package com.springboot.astra.service.serviceImpl;

import com.springboot.astra.bean.Permission;
import com.springboot.astra.bean.RolesPermission;
import com.springboot.astra.mapper.RolesPermissionMapper;
import com.springboot.astra.service.RolesPermissionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
@Service
public class RolesPermissionServiceImpl implements RolesPermissionService {
    @Autowired
    RolesPermissionMapper rolesPermissionMapper;
    @Override
    public RolesPermission getOneById(Integer id) {
        return rolesPermissionMapper.getOneById(id);
    }

    @Override
    public List<RolesPermission> getAll() {
        return rolesPermissionMapper.getAll();
    }

    @Override
    public void insertRolesPermission(RolesPermission rolesPermission) {
        rolesPermissionMapper.insertRolesPermission(rolesPermission);
    }

    @Override
    public void updateOneById(RolesPermission rolesPermission) {
        rolesPermissionMapper.updateOneById(rolesPermission);
    }

    @Override
    public void  deleteOneById(Integer id) {
        rolesPermissionMapper.deleteOneById(id);
    }

    @Override
    public RolesPermission isExact(RolesPermission rolesPermission) {
        return rolesPermissionMapper.isExact(rolesPermission);
    }

    @Override
    public void deleteAll(Integer roleId) {
        rolesPermissionMapper.deleteAll(roleId);
    }

    @Override
    public List<Permission> getAllByRoleId(Integer roleId) {
        return rolesPermissionMapper.getAllByRoleId(roleId);
    }
}
